package com.boarsoft.boar.label.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.boarsoft.bean.ReplyInfo;
import com.boarsoft.boar.entity.ObjLabel;
import com.boarsoft.boar.label.ObjLabelBiz;
import com.boarsoft.common.Authorized;
import com.boarsoft.common.dao.PagedResult;

@RestController
@RequestMapping("/label")
public class ObjLabelAction {
	@Autowired
	private ObjLabelBiz objLabelBiz;

	@RequestMapping("/save.do")
	@Authorized(code = "obj.label.save")
	public ReplyInfo<Object> save(ObjLabel o) {
		objLabelBiz.save(o);
		return ReplyInfo.SUCCESS;
	}

	@RequestMapping("/delete.do")
	@Authorized(code = "obj.label.delete")
	public ReplyInfo<Object> delete(String id) {
		objLabelBiz.delete(id);
		return ReplyInfo.SUCCESS;
	}

	@RequestMapping("/list.do")
	@Authorized(code = "obj.label.list")
	public ReplyInfo<Object> list(String objId, Integer objType, String key, String orderBy, int pageNo, int pageSize) {
		PagedResult<ObjLabel> pr = objLabelBiz.list(objId, objType, key, orderBy, pageNo, pageSize);
		return new ReplyInfo<Object>(true, pr);
	}
}